package chen.web.firewall;

import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class IpFilter extends AbstractFilter<IpTable> implements Filter {

	private static Log log = LogFactory.getLog(IpFilter.class);

	protected boolean accept(HttpServletRequest request){
		String ip = request.getRemoteAddr();
		boolean accept = super.getTable().accept(ip);
		if(!accept && log.isDebugEnabled()){
			log.debug( "ip禁止访问：" + ip);
		}
		return accept;
	}

}
